package com.xfcy.blog.controller.web;

import com.xfcy.blog.annotation.BusinessLogger;
import com.xfcy.blog.common.R;
import com.xfcy.blog.dto.MessageDTO;
import com.xfcy.blog.entity.Message;
import com.xfcy.blog.service.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 晓风残月Lx
 * @date 2023/4/19 17:05
 */
@RestController
@RequestMapping("/web/message")
@Api(tags = "留言接口")
public class WebMessageController {

    @Resource
    private MessageService messageService;

    @BusinessLogger(value = "留言模块-留言列表",type = "查询",desc = "留言列表")
    @ApiOperation(value = "留言模块-留言列表", httpMethod = "GET", response = R.class, notes = "留言列表")
    @RequestMapping(value = "/webMessage", method = RequestMethod.GET)
    public R webMessage() {
        return messageService.webMessage();
    }

    @BusinessLogger(value = "留言模块-用户留言",type = "添加",desc = "用户留言")
    @ApiOperation(value = "留言模块-添加留言", httpMethod = "POST", response = R.class, notes = "添加留言")
    @PostMapping("/add")
    public R addMessage(@RequestBody MessageDTO messageDTO) {
        return messageService.addMessage(messageDTO);
    }


}
